/**
 * 
 */
package com.eagle.coders.reporting.beans;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.enterprise.inject.Model;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.eagle.coders.common.bean.annotations.DomainTitle;
import com.eagle.coders.common.bean.annotations.PropertyConstraints;
import com.eagle.coders.common.bean.annotations.RadioButton;
import com.eagle.coders.common.bean.annotations.RadioButtons;
import com.eagle.coders.common.bean.annotations.UiComponentPosition;
import com.eagle.coders.common.bean.annotations.UnBound;
import com.eagle.coders.common.bean.annotations.type.MandatoryType;
import com.eagle.coders.common.bean.annotations.type.StringInputCaseType;
import com.eagle.coders.common.bean.annotations.type.TextFiledInputDataType;
import com.eagle.coders.reporting.beans.types.ReportCategoryType;
import com.eagle.coders.reporting.beans.types.ReportFrequencyType;
import com.eagle.coders.reporting.beans.types.ReportModuleType;
import com.eagle.coders.reporting.beans.types.ReportPeriorityType;
import com.eagle.coders.reporting.beans.types.ReportScheduleType;

/**
 * @author anees
 * 
 */
//@Entity
@Model
@Table(name = "eagle_reports")
@DomainTitle(title = "Reports")
@SequenceGenerator(name = "user_gen_seq", sequenceName = "eagle_gen_seq")
public class ReportsBean implements Serializable {

	private static final long serialVersionUID = 1L;

	private Integer reportId;
	private String reportName;
	private String reportDescription;
	private Integer reportSequence;
	private ReportCategoryType category;
	private ReportFrequencyType reportFrequency;
	private ReportModuleType module;
	private String preProcessingMode;
	private Integer printAfterBeforeDays;

	private Integer retentionPeriod;
	private Date reportStartDate;
	private Date reportEndDate;
	private ReportPeriorityType priority;

	private String outputFormat;
	private String reportGenrationMode; // Adhoc-online, Adhoc-offline

	private String outFilePassword;
	private String destinationType;
	
	private ReportScheduleType reportScheduleCycle;
	
	private Boolean isReportOnline;
	

	private List<ReportsParametersBean> reportParameters;

	/**
	 * @return the reportId
	 */
	@Id
	@GeneratedValue(generator = "user_gen_seq", strategy = GenerationType.SEQUENCE)
	@UnBound
	public Integer getReportId() {
		return reportId;
	}

	/**
	 * @param reportId
	 *            the reportId to set
	 */
	public void setReportId(Integer reportId) {
		this.reportId = reportId;
	}

	/**
	 * @return the reportName
	 */
	@UiComponentPosition(positionColumn = "1", positionRow = "1", tableDisplayColumn = "1")
	@PropertyConstraints(isMandatory = MandatoryType.TURE, maxLength = "8", inputCaseType = StringInputCaseType.MIXEDCASE, textInputDataType = TextFiledInputDataType.ALPHANUMERIC)
	@Column(name = "reportName", length = 20)
	public String getReportName() {
		return reportName;
	}

	/**
	 * @param reportName
	 *            the reportName to set
	 */
	public void setReportName(String reportName) {
		this.reportName = reportName;
	}

	/**
	 * @return the reportDescription
	 */
	@UiComponentPosition(positionColumn = "1", positionRow = "2", tableDisplayColumn = "-1")
	@PropertyConstraints(maxLength = "50")
	@Column(name = "description", length = 50)
	public String getReportDescription() {
		return reportDescription;
	}

	/**
	 * @param reportDescription
	 *            the reportDescription to set
	 */
	public void setReportDescription(String reportDescription) {
		this.reportDescription = reportDescription;
	}

	/**
	 * @return the reportSequence
	 */
	public Integer getReportSequence() {
		return reportSequence;
	}

	/**
	 * @param reportSequence
	 *            the reportSequence to set
	 */
	public void setReportSequence(Integer reportSequence) {
		this.reportSequence = reportSequence;
	}

	/**
	 * @return the category
	 */
	@Enumerated(EnumType.STRING)
	@UiComponentPosition(positionColumn = "1", positionRow = "4")
	@Column(name = "category", length = 50)
	public ReportCategoryType getCategory() {
		return category;
	}

	/**
	 * @param category
	 *            the category to set
	 */
	public void setCategory(ReportCategoryType category) {
		this.category = category;
	}

	/**
	 * @return the reportFrequency
	 */
	@Enumerated(EnumType.STRING)
	@UiComponentPosition(positionColumn = "1", positionRow = "5")
	@Column(name = "reportFrequency", length = 50)
	public ReportFrequencyType getReportFrequency() {
		return reportFrequency;
	}

	/**
	 * @param reportFrequency
	 *            the reportFrequency to set
	 */
	public void setReportFrequency(ReportFrequencyType reportFrequency) {
		this.reportFrequency = reportFrequency;
	}

	/**
	 * @return the module
	 */
	@Enumerated(EnumType.STRING)
	@UiComponentPosition(positionColumn = "1", positionRow = "3")
	@Column(name = "moduleType", length = 20)
	public ReportModuleType getModule() {
		return module;
	}

	/**
	 * @param module
	 *            the module to set
	 */
	public void setModule(ReportModuleType module) {
		this.module = module;
	}

	/**
	 * @return the preProcessingMode
	 */
	public String getPreProcessingMode() {
		return preProcessingMode;
	}

	/**
	 * @param preProcessingMode
	 *            the preProcessingMode to set
	 */
	public void setPreProcessingMode(String preProcessingMode) {
		this.preProcessingMode = preProcessingMode;
	}

	/**
	 * @return the printAfterBeforeDays
	 */
	public Integer getPrintAfterBeforeDays() {
		return printAfterBeforeDays;
	}

	/**
	 * @param printAfterBeforeDays
	 *            the printAfterBeforeDays to set
	 */
	public void setPrintAfterBeforeDays(Integer printAfterBeforeDays) {
		this.printAfterBeforeDays = printAfterBeforeDays;
	}

	/**
	 * @return the retentionPeriod
	 */
	@UiComponentPosition(positionColumn = "1", positionRow = "9")
	@Column(name = "retentionPeriod", length = 5)
	public Integer getRetentionPeriod() {
		return retentionPeriod;
	}

	/**
	 * @param retentionPeriod
	 *            the retentionPeriod to set
	 */
	public void setRetentionPeriod(Integer retentionPeriod) {
		this.retentionPeriod = retentionPeriod;
	}

	/**
	 * @return the reportStartDate
	 */
	@UiComponentPosition(positionColumn = "1", positionRow = "8")
	@Column(name = "reportStartTime", length = 50)
	public Date getReportStartDate() {
		return reportStartDate;
	}

	/**
	 * @param reportStartDate
	 *            the reportStartDate to set
	 */
	public void setReportStartDate(Date reportStartDate) {
		this.reportStartDate = reportStartDate;
	}

	/**
	 * @return the reportEndDate
	 */
	@UiComponentPosition(positionColumn = "2", positionRow = "8")
	@Column(name = "reportEndTime", length = 50)
	public Date getReportEndDate() {
		return reportEndDate;
	}

	/**
	 * @param reportEndDate
	 *            the reportEndDate to set
	 */
	public void setReportEndDate(Date reportEndDate) {
		this.reportEndDate = reportEndDate;
	}

	/**
	 * @return the priority
	 */
	@Enumerated(EnumType.STRING)
	@UiComponentPosition(positionColumn = "1", positionRow = "6")
	@Column(name = "periority", length = 20)
	public ReportPeriorityType getPriority() {
		return priority;
	}

	/**
	 * @param priority
	 *            the priority to set
	 */
	public void setPriority(ReportPeriorityType priority) {
		this.priority = priority;
	}

	/**
	 * @return the outputFormat
	 */
	@RadioButtons(values={
			@RadioButton(choice="p", label="PDF"), @RadioButton(choice = "c", label="CSV"),
			@RadioButton(choice="r", label="RTF")})
	@UiComponentPosition(positionColumn = "1", positionRow = "9")
	public String getOutputFormat() {
		return outputFormat;
	}

	/**
	 * @param outputFormat
	 *            the outputFormat to set
	 */
	public void setOutputFormat(String outputFormat) {
		this.outputFormat = outputFormat;
	}

	/**
	 * @return the reportGenrationMode
	 */
	@RadioButtons(values={
			@RadioButton(choice="i", label="Interactive"), @RadioButton(choice = "o", label="Background")})
	@UiComponentPosition(positionColumn = "1", positionRow = "11")
	public String getReportGenrationMode() {
		return reportGenrationMode;
	}

	/**
	 * @param reportGenrationMode
	 *            the reportGenrationMode to set
	 */
	public void setReportGenrationMode(String reportGenrationMode) {
		this.reportGenrationMode = reportGenrationMode;
	}

	/**
	 * @return the outFilePassword
	 */
	@UnBound
	public String getOutFilePassword() {
		return outFilePassword;
	}

	/**
	 * @param outFilePassword
	 *            the outFilePassword to set
	 */
	public void setOutFilePassword(String outFilePassword) {
		this.outFilePassword = outFilePassword;
	}

	/**
	 * @return the destinationType
	 */
	@RadioButtons(values={
			@RadioButton(choice="s", label="Screen"), @RadioButton(choice = "pr", label="Printer"),
			@RadioButton(choice="f", label="File"), @RadioButton(choice="e", label="Email")})
	@UiComponentPosition(positionColumn = "1", positionRow = "10")
	public String getDestinationType() {
		return destinationType;
	}

	/**
	 * @param destinationType
	 *            the destinationType to set
	 */
	public void setDestinationType(String destinationType) {
		this.destinationType = destinationType;
	}
	
	

	/**
	 * @return the reportScheduleCycle
	 */
	@Enumerated(EnumType.STRING)
	@UiComponentPosition(positionColumn = "1", positionRow = "7")
	@Column(name = "reportSchedule", length = 20)
	public ReportScheduleType getReportScheduleCycle() {
		return reportScheduleCycle;
	}

	/**
	 * @param reportScheduleCycle the reportScheduleCycle to set
	 */
	public void setReportScheduleCycle(ReportScheduleType reportScheduleCycle) {
		this.reportScheduleCycle = reportScheduleCycle;
	}
	
	

	/**
	 * @return the isReportOnline
	 */
	@UiComponentPosition(positionColumn = "1", positionRow = "20")
	@Column(name = "onlineReport")
	public Boolean getIsReportOnline() {
		return isReportOnline;
	}

	/**
	 * @param isReportOnline the isReportOnline to set
	 */
	public void setIsReportOnline(Boolean isReportOnline) {
		this.isReportOnline = isReportOnline;
	}

	/**
	 * @return the reportParameters
	 */
	@UiComponentPosition(positionColumn = "1", positionRow = "12")
	@OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL, targetEntity=ReportsParametersBean.class)
	@JoinColumn(name="reportParamterId", referencedColumnName="reportId")
	@Column(name="reportParamterId")
	public List<ReportsParametersBean> getReportParameters() {
		return reportParameters;
	}

	/**
	 * @param reportParameters
	 *            the reportParameters to set
	 */
	public void setReportParameters(List<ReportsParametersBean> reportParameters) {
		this.reportParameters = reportParameters;
	}

}
